//
//  File.swift
//  student1
//
//  Created by 张文升 on 2017/9/20.
//  Copyright © 2017年 张文升. All rights reserved.
//

import Foundation

public class GirlFrend:NSObject{
    private var _name:String = ""
    private var _age:Int = 0
    
    override init() {
        _name = generateRandomName(length: 5)
        _age = generateRandomAge(minAge: 22, maxAge: 45)
        
    }
    
    override public var description: String{
        get{
            return "约会: name is : \(_name) , age is : \(_age)"
        }
    }
}
func generateRandomAge(minAge:UInt32,maxAge:UInt32) -> Int {
    let randomAge:Int = Int(arc4random_uniform(maxAge-minAge) + minAge)
    return randomAge
}

func generateRandomName(length: Int) -> String {
    var output = ""
    for _ in 0..<length {
        let randomNumber = arc4random() % 26 + 97
        let randomChar = Character(UnicodeScalar(randomNumber)!)
        output.append(randomChar)
    }
    return output
}

func DateToGirl(){
    for _ in 0...999{
        let gf = GirlFrend()
        print(gf)
    }
}
